/**
* Created with CLion.
* User:Lenovo
* Date:2023-05-22
* Time:15:46
* Description:洛谷 P2329  栅栏
*/

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))

int count = 0;
int ans = 0;

bool dfs(int num, int m, int k, int n, int x, int *src, int *dst, int *used)
{

}

int cmp(const void *e1, const void *e2)
{
    return *(int *)e1 - *(int *)e2;
}

int main()
{
    int m;
    scanf("%d", &m);
    int src[m];
    for (int i = 0; i < m; i++)
    {
        scanf("%d", src + i);
    }
    int n;
    scanf("%d", &n);
    int dst[n];
    int used[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", dst + i);
        used[i] = 0;
    }
    // 排序目标木板，实现贪心和二分 - 截取最小的木板，同时具有二分的性质(截取的木板最多为 k，大于 k 的都不能实现，小于 k 的都可以实现 - 最小值最大，单调性)
    qsort(dst, n, sizeof(int), cmp);

    int l = 0, r = n;
    while (l < r)
    {
        count = 0;
        int mid = (l + r) >> 1;
        if (dfs(mid, m, 0, n, n - 1, src, dst, used))
        {
            l = mid;
        }
        else
        {
            r = mid - 1;
        }
    }

    printf("%d", r);

    return 0;
}